package com.gxgeek.spring.security.config;

import com.gxgeek.spring.security.securitycore.validate.code.image.ImageCode;
import com.gxgeek.spring.security.securitycore.validate.code.image.ImageCodeGenerator;
import com.gxgeek.spring.security.securitycore.validate.code.ValidateCodeGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.ServletWebRequest;

/**
 * @author gaoxing
 * @create 2017-10-18 上午11:49
 */
@Configuration
@Slf4j
public class ValidateCodeConfig {

    @Bean//使用应用级别 配置覆盖  自带配置
    public ValidateCodeGenerator imageValidateCodeGenerator(){
        return new ImageCodeGenerator(){
            @Override
            public ImageCode generatorCode(ServletWebRequest request) {
                log.info("更高级方法");
                return super.generatorCode(request);
            }
        };

    }
}
